import Vue from 'vue'
import Router from 'vue-router'
import HomeIndex from '@/views/home'
// import Activity from '../views/activity.vue'
Vue.use(Router)

export const constantRouterMap = [
  {
    path: '/',//登录
    component: HomeIndex,
    children: [
      { path: '/', component: () => import('@/views/index') },//首页
      { path: '/contact', component: () => import('@/views/contact') },//联系我们
      { path: '/introduction', component: () => import('@/views/introduction') },//园所风貌--幼儿园简介
      { path: '/introduction/department', component: () => import('@/views/department') },//部门设置
      { path: '/introduction/linian', component: () => import('@/views/linian') },//教育理念

      { path: '/growup', component: () => import('@/views/growup') },//成长记录
      { path: '/teachers', component: () => import('@/views/teachers') },//师资队伍
      
      { path: '/activity', component: () => import('@/views/activity') },//活动风采---优秀作品
      { path: '/activity/homeducate', component: () => import('@/views/homeducate') },//家园共育
      { path: '/activity/exactivity', component: () => import('@/views/exactivity') },//精彩活动
      
      { path: '/lesson', component: () => import('@/views/lesson') },//课程体系--文化课
      { path: '/lesson/talent', component: () => import('@/views/talent') },//才艺课
      { path: '/lesson/public', component: () => import('@/views/public') },//公共课
      { path: '/info', component: () => import('@/views/info') },//资讯列表
	    { path: '/subjectInfo', component: () => import('@/views/subjectInfo') },//新闻详情
      
    ]
  },
  { path: '/404', component: () => import('@/views/404') },
  { path: '/500', component: () => import('@/views/500') },
  { path: '/502', component: () => import('@/views/502') },
  { path: '/*', component: () => import('@/views/404') }

];

const router = new Router({
  //设置路由模式为'history'，去掉访问首页时的#
//   mode:"history",
  routes: constantRouterMap
});

// router.beforeEach((to, from, next) => {
//   var reloaded = window.localStorage.getItem('reloaded') || '0'
//   if (to.path === '/about') {
//     window.localStorage.setItem('reloaded', reloaded)
//   } else if (from.path === '/about') {
//     var count = Number(reloaded) + 1
//     window.localStorage.setItem('reloaded', count)
//   }
//   next()
// })

export default router
